
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _ProductDetailHistories : SqlClientEntity
	{
		public _ProductDetailHistories()
		{
			this.QuerySource = "ProductDetailHistories";
			this.MappingName = "ProductDetailHistories";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductDetailHistoriesLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductDetailHistoriesLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter ProductDetailID
			{
				get
				{
					return new SqlParameter("@ProductDetailID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter ProductStatusID
			{
				get
				{
					return new SqlParameter("@ProductStatusID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter StockLocationID
			{
				get
				{
					return new SqlParameter("@StockLocationID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SavedDate
			{
				get
				{
					return new SqlParameter("@SavedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter UserID
			{
				get
				{
					return new SqlParameter("@UserID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CustomerID
			{
				get
				{
					return new SqlParameter("@CustomerID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SupplierID
			{
				get
				{
					return new SqlParameter("@SupplierID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Cost
			{
				get
				{
					return new SqlParameter("@Cost", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter Description
			{
				get
				{
					return new SqlParameter("@Description", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string ProductDetailID = "ProductDetailID";
            public const string ProductStatusID = "ProductStatusID";
            public const string StockLocationID = "StockLocationID";
            public const string SavedDate = "SavedDate";
            public const string UserID = "UserID";
            public const string CustomerID = "CustomerID";
            public const string SupplierID = "SupplierID";
            public const string Cost = "Cost";
            public const string Description = "Description";
            public const string BranchID = "BranchID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _ProductDetailHistories.PropertyNames.ID;
					ht[ProductDetailID] = _ProductDetailHistories.PropertyNames.ProductDetailID;
					ht[ProductStatusID] = _ProductDetailHistories.PropertyNames.ProductStatusID;
					ht[StockLocationID] = _ProductDetailHistories.PropertyNames.StockLocationID;
					ht[SavedDate] = _ProductDetailHistories.PropertyNames.SavedDate;
					ht[UserID] = _ProductDetailHistories.PropertyNames.UserID;
					ht[CustomerID] = _ProductDetailHistories.PropertyNames.CustomerID;
					ht[SupplierID] = _ProductDetailHistories.PropertyNames.SupplierID;
					ht[Cost] = _ProductDetailHistories.PropertyNames.Cost;
					ht[Description] = _ProductDetailHistories.PropertyNames.Description;
					ht[BranchID] = _ProductDetailHistories.PropertyNames.BranchID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string ProductDetailID = "ProductDetailID";
            public const string ProductStatusID = "ProductStatusID";
            public const string StockLocationID = "StockLocationID";
            public const string SavedDate = "SavedDate";
            public const string UserID = "UserID";
            public const string CustomerID = "CustomerID";
            public const string SupplierID = "SupplierID";
            public const string Cost = "Cost";
            public const string Description = "Description";
            public const string BranchID = "BranchID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _ProductDetailHistories.ColumnNames.ID;
					ht[ProductDetailID] = _ProductDetailHistories.ColumnNames.ProductDetailID;
					ht[ProductStatusID] = _ProductDetailHistories.ColumnNames.ProductStatusID;
					ht[StockLocationID] = _ProductDetailHistories.ColumnNames.StockLocationID;
					ht[SavedDate] = _ProductDetailHistories.ColumnNames.SavedDate;
					ht[UserID] = _ProductDetailHistories.ColumnNames.UserID;
					ht[CustomerID] = _ProductDetailHistories.ColumnNames.CustomerID;
					ht[SupplierID] = _ProductDetailHistories.ColumnNames.SupplierID;
					ht[Cost] = _ProductDetailHistories.ColumnNames.Cost;
					ht[Description] = _ProductDetailHistories.ColumnNames.Description;
					ht[BranchID] = _ProductDetailHistories.ColumnNames.BranchID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string ProductDetailID = "s_ProductDetailID";
            public const string ProductStatusID = "s_ProductStatusID";
            public const string StockLocationID = "s_StockLocationID";
            public const string SavedDate = "s_SavedDate";
            public const string UserID = "s_UserID";
            public const string CustomerID = "s_CustomerID";
            public const string SupplierID = "s_SupplierID";
            public const string Cost = "s_Cost";
            public const string Description = "s_Description";
            public const string BranchID = "s_BranchID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual int ProductDetailID
	    {
			get
	        {
				return base.Getint(ColumnNames.ProductDetailID);
			}
			set
	        {
				base.Setint(ColumnNames.ProductDetailID, value);
			}
		}

		public virtual int ProductStatusID
	    {
			get
	        {
				return base.Getint(ColumnNames.ProductStatusID);
			}
			set
	        {
				base.Setint(ColumnNames.ProductStatusID, value);
			}
		}

		public virtual int StockLocationID
	    {
			get
	        {
				return base.Getint(ColumnNames.StockLocationID);
			}
			set
	        {
				base.Setint(ColumnNames.StockLocationID, value);
			}
		}

		public virtual DateTime SavedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.SavedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.SavedDate, value);
			}
		}

		public virtual int UserID
	    {
			get
	        {
				return base.Getint(ColumnNames.UserID);
			}
			set
	        {
				base.Setint(ColumnNames.UserID, value);
			}
		}

		public virtual int CustomerID
	    {
			get
	        {
				return base.Getint(ColumnNames.CustomerID);
			}
			set
	        {
				base.Setint(ColumnNames.CustomerID, value);
			}
		}

		public virtual int SupplierID
	    {
			get
	        {
				return base.Getint(ColumnNames.SupplierID);
			}
			set
	        {
				base.Setint(ColumnNames.SupplierID, value);
			}
		}

		public virtual decimal Cost
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.Cost);
			}
			set
	        {
				base.Setdecimal(ColumnNames.Cost, value);
			}
		}

		public virtual string Description
	    {
			get
	        {
				return base.Getstring(ColumnNames.Description);
			}
			set
	        {
				base.Setstring(ColumnNames.Description, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_ProductDetailID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProductDetailID) ? string.Empty : base.GetintAsString(ColumnNames.ProductDetailID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProductDetailID);
				else
					this.ProductDetailID = base.SetintAsString(ColumnNames.ProductDetailID, value);
			}
		}

		public virtual string s_ProductStatusID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProductStatusID) ? string.Empty : base.GetintAsString(ColumnNames.ProductStatusID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProductStatusID);
				else
					this.ProductStatusID = base.SetintAsString(ColumnNames.ProductStatusID, value);
			}
		}

		public virtual string s_StockLocationID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.StockLocationID) ? string.Empty : base.GetintAsString(ColumnNames.StockLocationID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.StockLocationID);
				else
					this.StockLocationID = base.SetintAsString(ColumnNames.StockLocationID, value);
			}
		}

		public virtual string s_SavedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SavedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.SavedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SavedDate);
				else
					this.SavedDate = base.SetDateTimeAsString(ColumnNames.SavedDate, value);
			}
		}

		public virtual string s_UserID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.UserID) ? string.Empty : base.GetintAsString(ColumnNames.UserID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.UserID);
				else
					this.UserID = base.SetintAsString(ColumnNames.UserID, value);
			}
		}

		public virtual string s_CustomerID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerID) ? string.Empty : base.GetintAsString(ColumnNames.CustomerID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerID);
				else
					this.CustomerID = base.SetintAsString(ColumnNames.CustomerID, value);
			}
		}

		public virtual string s_SupplierID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SupplierID) ? string.Empty : base.GetintAsString(ColumnNames.SupplierID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SupplierID);
				else
					this.SupplierID = base.SetintAsString(ColumnNames.SupplierID, value);
			}
		}

		public virtual string s_Cost
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Cost) ? string.Empty : base.GetdecimalAsString(ColumnNames.Cost);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Cost);
				else
					this.Cost = base.SetdecimalAsString(ColumnNames.Cost, value);
			}
		}

		public virtual string s_Description
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Description) ? string.Empty : base.GetstringAsString(ColumnNames.Description);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Description);
				else
					this.Description = base.SetstringAsString(ColumnNames.Description, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProductDetailID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProductDetailID, Parameters.ProductDetailID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProductStatusID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProductStatusID, Parameters.ProductStatusID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter StockLocationID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.StockLocationID, Parameters.StockLocationID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SavedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SavedDate, Parameters.SavedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter UserID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.UserID, Parameters.UserID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SupplierID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SupplierID, Parameters.SupplierID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Cost
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Cost, Parameters.Cost);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Description
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Description, Parameters.Description);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter ProductDetailID
		    {
				get
		        {
					if(_ProductDetailID_W == null)
	        	    {
						_ProductDetailID_W = TearOff.ProductDetailID;
					}
					return _ProductDetailID_W;
				}
			}

			public WhereParameter ProductStatusID
		    {
				get
		        {
					if(_ProductStatusID_W == null)
	        	    {
						_ProductStatusID_W = TearOff.ProductStatusID;
					}
					return _ProductStatusID_W;
				}
			}

			public WhereParameter StockLocationID
		    {
				get
		        {
					if(_StockLocationID_W == null)
	        	    {
						_StockLocationID_W = TearOff.StockLocationID;
					}
					return _StockLocationID_W;
				}
			}

			public WhereParameter SavedDate
		    {
				get
		        {
					if(_SavedDate_W == null)
	        	    {
						_SavedDate_W = TearOff.SavedDate;
					}
					return _SavedDate_W;
				}
			}

			public WhereParameter UserID
		    {
				get
		        {
					if(_UserID_W == null)
	        	    {
						_UserID_W = TearOff.UserID;
					}
					return _UserID_W;
				}
			}

			public WhereParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public WhereParameter SupplierID
		    {
				get
		        {
					if(_SupplierID_W == null)
	        	    {
						_SupplierID_W = TearOff.SupplierID;
					}
					return _SupplierID_W;
				}
			}

			public WhereParameter Cost
		    {
				get
		        {
					if(_Cost_W == null)
	        	    {
						_Cost_W = TearOff.Cost;
					}
					return _Cost_W;
				}
			}

			public WhereParameter Description
		    {
				get
		        {
					if(_Description_W == null)
	        	    {
						_Description_W = TearOff.Description;
					}
					return _Description_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _ProductDetailID_W = null;
			private WhereParameter _ProductStatusID_W = null;
			private WhereParameter _StockLocationID_W = null;
			private WhereParameter _SavedDate_W = null;
			private WhereParameter _UserID_W = null;
			private WhereParameter _CustomerID_W = null;
			private WhereParameter _SupplierID_W = null;
			private WhereParameter _Cost_W = null;
			private WhereParameter _Description_W = null;
			private WhereParameter _BranchID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_ProductDetailID_W = null;
				_ProductStatusID_W = null;
				_StockLocationID_W = null;
				_SavedDate_W = null;
				_UserID_W = null;
				_CustomerID_W = null;
				_SupplierID_W = null;
				_Cost_W = null;
				_Description_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProductDetailID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProductDetailID, Parameters.ProductDetailID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProductStatusID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProductStatusID, Parameters.ProductStatusID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter StockLocationID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.StockLocationID, Parameters.StockLocationID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SavedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SavedDate, Parameters.SavedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter UserID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.UserID, Parameters.UserID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SupplierID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SupplierID, Parameters.SupplierID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Cost
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Cost, Parameters.Cost);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Description
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Description, Parameters.Description);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter ProductDetailID
		    {
				get
		        {
					if(_ProductDetailID_W == null)
	        	    {
						_ProductDetailID_W = TearOff.ProductDetailID;
					}
					return _ProductDetailID_W;
				}
			}

			public AggregateParameter ProductStatusID
		    {
				get
		        {
					if(_ProductStatusID_W == null)
	        	    {
						_ProductStatusID_W = TearOff.ProductStatusID;
					}
					return _ProductStatusID_W;
				}
			}

			public AggregateParameter StockLocationID
		    {
				get
		        {
					if(_StockLocationID_W == null)
	        	    {
						_StockLocationID_W = TearOff.StockLocationID;
					}
					return _StockLocationID_W;
				}
			}

			public AggregateParameter SavedDate
		    {
				get
		        {
					if(_SavedDate_W == null)
	        	    {
						_SavedDate_W = TearOff.SavedDate;
					}
					return _SavedDate_W;
				}
			}

			public AggregateParameter UserID
		    {
				get
		        {
					if(_UserID_W == null)
	        	    {
						_UserID_W = TearOff.UserID;
					}
					return _UserID_W;
				}
			}

			public AggregateParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public AggregateParameter SupplierID
		    {
				get
		        {
					if(_SupplierID_W == null)
	        	    {
						_SupplierID_W = TearOff.SupplierID;
					}
					return _SupplierID_W;
				}
			}

			public AggregateParameter Cost
		    {
				get
		        {
					if(_Cost_W == null)
	        	    {
						_Cost_W = TearOff.Cost;
					}
					return _Cost_W;
				}
			}

			public AggregateParameter Description
		    {
				get
		        {
					if(_Description_W == null)
	        	    {
						_Description_W = TearOff.Description;
					}
					return _Description_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _ProductDetailID_W = null;
			private AggregateParameter _ProductStatusID_W = null;
			private AggregateParameter _StockLocationID_W = null;
			private AggregateParameter _SavedDate_W = null;
			private AggregateParameter _UserID_W = null;
			private AggregateParameter _CustomerID_W = null;
			private AggregateParameter _SupplierID_W = null;
			private AggregateParameter _Cost_W = null;
			private AggregateParameter _Description_W = null;
			private AggregateParameter _BranchID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_ProductDetailID_W = null;
				_ProductStatusID_W = null;
				_StockLocationID_W = null;
				_SavedDate_W = null;
				_UserID_W = null;
				_CustomerID_W = null;
				_SupplierID_W = null;
				_Cost_W = null;
				_Description_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductDetailHistoriesInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductDetailHistoriesUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductDetailHistoriesDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProductDetailID);
			p.SourceColumn = ColumnNames.ProductDetailID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProductStatusID);
			p.SourceColumn = ColumnNames.ProductStatusID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.StockLocationID);
			p.SourceColumn = ColumnNames.StockLocationID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SavedDate);
			p.SourceColumn = ColumnNames.SavedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.UserID);
			p.SourceColumn = ColumnNames.UserID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerID);
			p.SourceColumn = ColumnNames.CustomerID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SupplierID);
			p.SourceColumn = ColumnNames.SupplierID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Cost);
			p.SourceColumn = ColumnNames.Cost;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Description);
			p.SourceColumn = ColumnNames.Description;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
